printer 2.2.1
Loading...
Searching...
No Matches
printer


Printer Click

Printer Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Oct 2024.
  • Type : UART type

Software Support

Example Description

This example demonstrates the use of Printer Click board by providing user interaction with a thermal printer, allowing the user to check paper status, display commands, and execute various printing tasks based on user commands through a UART interface.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Printer

Example Key Functions

Application Init

Initializes the driver, performs the Click default configuration, and displays the list of supported commands on the USB UART.

void application_init ( void )
{
log_cfg_t log_cfg;
printer_cfg_t printer_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
printer_cfg_setup( &printer_cfg );
if ( UART_ERROR == printer_init( &printer, &printer_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( PRINTER_ERROR == printer_default_cfg ( &printer ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
printer_display_commands ( );
log_info( &logger, " Application Task " );
}
#define PRINTER_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition printer.h:228
void application_init(void)
Definition main.c:66
#define MIKROBUS_POSITION_PRINTER
Definition main.c:31
@ PRINTER_ERROR
Definition printer.h:286

Application Task

Checks the paper status and processes user commands.

void application_task ( void )
{
uint8_t command = 0;
printer_check_paper ( &printer );
if ( 1 == log_read ( &logger, &command, 1 ) )
{
printer_parse_command ( &printer, command );
}
}
void application_task(void)
Definition main.c:103

Note

The default printer head type is set to LTP02-245-13.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.